package me.shiqiang.im.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * @author cuishiqiang
 * @date 2018/5/30 下午9:39
 */
@Service
@CacheConfig(cacheNames = "serverNode")
public class MsgService {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    ServerNodeClient serverNodeClient;

    @Cacheable
    public String getServerId(String userId){
        logger.info("p2p调用微服务获取数据");
        return serverNodeClient.getServerId(userId);
    }

    @Cacheable
    public Set<String> getGroupServerIdSet(String groupId) {
        logger.info("群调用微服务获取数据");
        return serverNodeClient.getGroupServerIdSet(groupId);
    }
}
